import media from '@ohos.multimedia.media';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import JsDataStore from '../QtCore/JsDataStore';

export class JsMultimediaUtils {
    private media = mediaLibrary.getMediaLibrary(JsDataStore.getContext());

    constructor(){}

    async getMediaDirectory(type:number){
        const dictResult = await this.media.getPublicDirectory(type);
        return dictResult;
    }
}

export function to(promise) {
    return promise.then(data => {
        return [null, data];
    }).catch(err => [err]);
}
